package org.amse.korovkin.ciphering.view;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class AboutJDialog extends JDialog{
    CipheringJFrame parent;
    Dimension mySize = new Dimension(300, 240);
    JButton close = new JButton("Close");
    JTextArea text = new JTextArea();
    public AboutJDialog(CipheringJFrame jFrame) {
        super(jFrame, "About", true);
        parent = jFrame;
        setSize(mySize);
        setResizable(false);
        setLocation(parent.getX() + (parent.getWidth() - mySize.width) / 2
                , parent.getY() + (parent.getHeight() - mySize.height) / 2);
        text.setPreferredSize(new Dimension(mySize.width - 20, mySize.height - 70));
        text.setText("This program is designed as program for encrypt \n" +
                "and decrypt English texts by monoalphabet cipher.\n" +
                "You must choose readyKey or generate random\n" +
                "Key for this. You can also try to attack encrypted file\n" +
                "without key. You must choose statistic file or\n" +
                "generate a new one by any apposite file for this.\n\n" +
                "Program was created by Michail Korovkin with\nEvgeny Linsky help.");
        text.setEditable(false);
        text.setOpaque(false);
        text.setLineWrap(true);
        Container c = getContentPane();
        c.setLayout(new FlowLayout());
        c.add(text);
        c.add(close);
        close.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                dispose();
            }
        });
        setVisible(true);
    }
}
